<div class="box_right">
	<h1>发票管理</h1>
	<div class="pro_box">
		<form class="layui-form" action="<?php echo base_url().'gasstation/order/fapiao'?>" method="get">
		<div class="layui-form-item">
		  <div class="layui-form-item">
		  <div class="layui-inline">
		    <label class="layui-form-label" style="width: 110px;">订单编号</label>
		    <div class="layui-input-inline" style="width: 200px;">
		    	<input type="text" class="layui-input" name="order_no" value="<?php if (isset($order_no)) echo $order_no;?>">
		    </div>
		  </div>
		  </div>
		  
		  <div class="layui-form-item">
		  <div class="layui-inline">
		    <label class="layui-form-label" style="width: 110px;">发票</label>
		    <div class="layui-input-inline" style="width: 200px;">
		    	<select name="invoice_type" id="invoice_type">
					<option value="">全部</option>
					<option value="0" <?php if (isset($invoice_type)&&$invoice_type == '0')echo "selected";?>>未开</option>
					<option value="1" <?php if (isset($invoice_type)&&$invoice_type == '1')echo "selected";?>>已开</option>
				</select>
		    </div>
		  </div>
		  </div>
		  
		  <div class="layui-inline">
		    <label class="layui-form-label" style="width: 110px;">选择日期</label>
		    <div class="layui-input-inline" style="width: 200px;">
		    	<input name="date1" type="text" class="layui-input" id="test5" placeholder="年-月-日 时:分:秒" value="<?php if (isset($date1))echo $date1;?>" >
		    </div>
		    <div class="layui-form-mid">到</div>
		    <div class="layui-input-inline" style="width: 200px;">
		    	<input name="date2" type="text" class="layui-input" id="test6" placeholder="年-月-日 时:分:秒" value="<?php if (isset($date2))echo $date2;?>" >
		    </div>
		    <p class="say">单次查询日期的最长跨度为31天</p>
		  </div>
		  </div>
		  
		  <div class="layui-form-item">
		  <div class="layui-inline">
		    <label class="layui-form-label" style="width: 110px;">订单状态</label>
		    <div class="layui-input-inline" style="width: 200px;">
		    	<select name="payment_status" id="payment_status" style="height: 23px;">
					<option value="">全部</option>
					<option value="0" <?php if (isset($payment_status)&&$payment_status == '0')echo "selected";?>>未支付</option>
					<option value="1" <?php if (isset($payment_status)&&$payment_status == '1')echo "selected";?>>已支付</option>
					<option value="2" <?php if (isset($payment_status)&&$payment_status == '2')echo "selected";?>>已取消</option>
				</select>
		    </div>
		  </div>
		  </div>
		  
		  <div class="layui-form-item">
		  <div class="layui-inline">
		    <label class="layui-form-label" style="width: 110px;">支付方式</label>
		    <div class="layui-input-inline" style="width: 200px;">
		    	<select name="payment_id" id="payment_id" style="height: 23px;">
					<option value="">全部</option>
					<option value="3" <?php if (isset($payment_id)&&$payment_id == '3')echo "selected";?>>微信公众号支付</option>
					<option value="6" <?php if (isset($payment_id)&&$payment_id == '6')echo "selected";?>>支付宝APP支付</option>
					<option value="7" <?php if (isset($payment_id)&&$payment_id == '7')echo "selected";?>>微信APP支付</option>
					<option value="8" <?php if (isset($payment_id)&&$payment_id == '8')echo "selected";?>>钱包支付</option>
					<option value="9" <?php if (isset($payment_id)&&$payment_id == '9')echo "selected";?>>小程序支付</option>
				</select>
		    </div>
		  </div>
		  </div>
		  
		  <div class="layui-form-item">
		    <div class="layui-input-block">
		      <button class="btn_tj" type="submit">查询</button>
		    </div>
		  </div>
		</form>
		  
		  <div class="order_list">
		  	<div class="layui-row">
		  		<div class="layui-col-xs4">
		  			<h2 class="order_list_h">订单列表</h2>
		  		</div>
		  		<!--<div class="layui-col-xs1 layui-col-xs-offset7">
		  			<button class="btn_get">导出</button>
		  		</div>-->
		  	</div>
		  		
			<table class="layui-table ct" lay-skin="line">
			  <thead>
				<tr>
					<th>会员</th>
					<th>订单编号</th>
					<th>油号</th>
                    <th>油枪</th>
                    <th>加油量</th>
                    <th>支付方式</th>
                    <th>订单状态</th>
                    <th>订单总额</th>
                    <th>下单时间</th>
                    <th>发票</th>
                    <th>操作</th>
				</tr>
			  </thead>
			  <tbody>
			    <?php if (isset($result)&&count($result)>0){
						foreach ($result as $app){
				?>
				<tr>
					<td><?php echo $app->card_name;?></td>
					<td><?php echo $app->order_no;?></td>
                    <td><?php echo $app->glmodel_name;?></td>
                    <td><?php echo $app->oilgun_name;?></td>
                    <td><?php echo $app->oil_liters;?></td>
                    <td><?php 
						if($app->payment_id == 3){
                        	echo "微信公众号支付";
						}elseif($app->payment_id == 6){
							echo "支付宝APP支付";
						}elseif($app->payment_id == 7){
							echo "微信APP支付";
						}elseif($app->payment_id == 8){
							echo "钱包支付";
						}elseif($app->payment_id == 9){
							echo "小程序支付";
						}
						?>
					</td>
					<td><?php 
						if($app->payment_status == 0){
							echo "未支付";
						}elseif($app->payment_status == 1){
							echo "已支付";
						}elseif($app->payment_status == 2){
                        	echo "已取消";
                        }
					?></td>
					<td><?php echo $app->order_price;?></td>
					<td><?php echo $app->create_time;?></td>
                    <td><?php 
                    if($app->invoice_type == 0){
                            	echo "未开";
                    }elseif($app->invoice_type == 1){
                            	echo "已开";
							}
						?>
					</td>
                    <td>
						<?php if (in_array('gasstation/order/look_fapiao_order', $_SESSION['GASSTATION_ACL_ARR'])){?>
						<a class="btn btn-sm btn-info" href="<?php echo base_url().'gasstation/order/look_fapiao_order/'.$app->id;?>"><i class="icon-edit"></i>订单详细</a>
						<?php }?>
                        <?php if ($app->invoice_type == 0){?>
                        	<?php if (in_array('gasstation/order/make_fapiao', $_SESSION['GASSTATION_ACL_ARR'])){?>
                            <a class="btn btn-sm btn-info" href="<?php echo base_url().'gasstation/order/make_fapiao/'.$app->id;?>"><i class="icon-edit"></i>开发票</a>
                            <?php }?>
                        <?php }else{?>
                        	<?php if (in_array('gasstation/order/look_fapiao', $_SESSION['GASSTATION_ACL_ARR'])){?>
							<a class="btn btn-sm btn-info" href="<?php echo base_url().'gasstation/order/look_fapiao/'.$app->id;?>"><i class="icon-edit"></i>发票详细</a>
							<?php }?>
                        <?php }?>
					 </td>
				</tr>
				<?php }
					}else{?>
				<tr>
					 <td colspan="15">无数据</td>
				</tr>
				<?php }?>
			  </tbody>
			</table>
		  </div>
		  <div class="col-sm-12">
            <div class="modal-footer no-margin-top">
            	<div class="pull-left record">
				共<?php echo $count;?>条记录
                </div>
            	<?php if (isset($page))echo $page;?>
          	</div>
          </div> 
	</div>
</div>
<script>
//Demo
layui.use(['form','element','laydate'], function(){
  var form = layui.form,
  	element = layui.element,
  	laydate = layui.laydate;

  //时间选择器
  laydate.render({
    elem: '#test5'
    ,type: 'datetime'
  });
    //时间选择器
  laydate.render({
    elem: '#test6'
    ,type: 'datetime'
  }); 
  
  //监听提交
  form.on('submit(formDemo)', function(data){
    layer.msg(JSON.stringify(data.field));
    return false;
  });
});
</script>

	